<template>
  <view></view>
</template>

<script setup>
import { ref } from 'vue';
import { useUserStore } from '@/store/user';

const emit = defineEmits(['login-success']);
const userStore = useUserStore();
const loginPopupRef = ref(null);

// 设置登录弹窗引用
const setLoginPopupRef = (ref) => {
  loginPopupRef.value = ref;
};

// 检查是否需要显示登录弹窗
const checkLoginPopup = () => {
  if (!userStore.isLoggedIn) {
    showLoginPopup();
  }
};

// 显示登录弹窗
const showLoginPopup = () => {
  if (loginPopupRef.value) {
    loginPopupRef.value.open();
  }
};

// 暴露方法给父组件
defineExpose({
  setLoginPopupRef,
  checkLoginPopup,
  showLoginPopup
});
</script>

<style>
</style> 